package com.itheima.mapper;


import com.itheima.dto.OrdersStatisticsDto;
import com.itheima.pojo.User;
import com.itheima.vo.UserReportVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface UserMapper {

    @Select("select * from user where openid=#{openid}")
    User selectUserByCode(String openid);


    @Insert("insert into user(openid, name, phone, sex, id_number, avatar, create_time)" +
            " values (#{openid},#{name},#{phone},#{sex},#{idNumber},#{avatar},#{createTime})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void insertUser(User user);
    /**
     * 用户统计接口
     * @param statisticsDto
     * @return
     */
    UserReportVO userStatistics(OrdersStatisticsDto statisticsDto);


    /**
     * 查询今日运营数据
     * @return
     */
    Integer select();


    Integer getNewUser(LocalDateTime begin, LocalDateTime end);
}
